
$(function () {
    $("#log").click(function () {
        let username = $("#username").val();
        let password = $("#password").val();
        let flag = $("#flag").val();
        console.log(flag+"========")

        // $("#outer").load("/prj/seller/view.action",{pageNow:1,pageSize:obj.value});

        // window.location.add("username",username);
        // window.location.add("password",password);
        // window.location="/prj/logAndRegist/log.action";
        window.location="/prj/logAndRegist/log.action?username="+username+"&password="+password+"&flag="+flag;
        // window.location="/prj/logRegist/log?username="+username+"&password="+password;


        // $.ajax({
        //     type:"post",
        //     // url:"/prj/jsp/index/index.jsp",
        //     url:"/prj/logAndRegist/log",
        //     data:{
        //         "username":username,
        //         "password":password
        //     },
        //     dataType:'json',
        // })
    })
});

$(function () {
    $("#hidden").hide();
    $("#hide2").hide();

    $("#phone").click(function () {
        let phone = $("#phone").val();
        if(!(/^1[3456789]\d{9}$/.test(phone))){
            $("#hidden").show();
            return;
        }
    });
    $("#phone").mouseout(function () {
        let phone = $("#phone").val();
        if((/^1[3456789]\d{9}$/.test(phone))){
            $("#hidden").hide();
            return;
        }
    });

    $("#pwd").click(function () {
        let pwd = $("#pwd").val();
        if(!(/^(\w){6,12}$/.test(pwd))){
            $("#hide2").show();
            return;
        }
    });
    $("#pwd").mouseout(function () {
        let pwd = $("#pwd").val();
        if((/^(\w){6,12}$/.test(pwd))){
            $("#hide2").hide();
            return;
        }
    });


    $("#reg").click(function () {
        let username = $("#username").val();
        let phone = $("#phone").val();
        let pwd = $("#pwd").val();
        let code = $("#codes").val();
        let ch;
        var checkAgain = document.getElementsByName("check");
        for (i in checkAgain){
            if (checkAgain[i].checked){
                ch = true;
            }
        }
        if(!(/^1[3456789]\d{9}$/.test(phone))){
            alert("请输入正确的手机号");
            return;
        }else if(!(/^\d{4}$/.test(code))) {
            alert("请输入正确的验证码");
            return;
        }else if (!ch){
            alert("未同意注册协议不可进行注册！！！");
            return;
        }

        window.location= "/prj/logAndRegist/register/"+username+"/"+phone+"/"+pwd+"/"+code;
    });

});